{include file="common/header"/}
<div class="layui-fluid">
    <div class="layui-row layui-col-space15">
        <div class="layui-col-md12">
            <div class="layui-card">
                <div class="layui-card-body">
                    <div class="layui-row">
                        <form action="" class="layui-form">
                        <div class="layui-row layui-col-space10">
                            <div class="layui-inline">
                                <div class="layui-input-inline">
                                  <select name="" id="wxappid">
                                    <option value="">来源</option>
                                    {volist name="wx" id="vo" key=key}
                                    <option value="{$vo.appid}">{$vo.name}</option>
                                    {/volist}
                                  </select>
                                </div>
                                <div class="layui-input-inline">
                                  <input type="text" name="" id="keys" lay-verify="required" placeholder="请输入" class="layui-input">
                                </div>
                                <input type="button" id="searchBtn" name="submit" class="layui-btn" value="搜索">
                            </div>
                            
                        </div>
                      </form>
                    </div>
                    <div class="layui-row">
                        <table class="layui-table" id="list" lay-filter="list"></table>
                    </div>
                </div>
            

            </div>
        </div>
    </div>
</div>

<script type="text/html" id="toolbarDemo">
    <div class="layui-btn-group">
        <a data-href="{:url('del')}"  class="layui-btn layui-btn-sm layui-btn-danger" id="delAll">{:lang('delete checked')}</a>
    </div>
    
</script>


<script type="text/html" id="action">
<div class="layui-btn-group">
    <a data-href="{:url('del')}?id={{d.id}}" class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">{:lang('del')}</a>
</div>
</script>

<script type="text/html" id="sex">
    {{# if(d.sex==1){ }}
    男
    {{# }else if( d.sex==2){ }}
    女
    {{# }else{ }}
        保密
    {{# } }}
</script>
<script type="text/html" id="username">
    {{ d.username }}<img src="/static/admin/images/image.gif" onmouseover="layer.tips('<img src={{d.avatar}}>',this,{tips: [1, '#fff']});" onmouseout="layer.closeAll();">
</script>

{include file="common/footer"/}
<script>
var table;
var searchObj = {};
layui.use(['table'], function () {
    var $ = layui.jquery,
        table = layui.table;

    table.render({
        elem: '#list',
        url: '{:url("index")}',
        method: 'post',
        title: '用户数据表',
        toolbar: '#toolbarDemo', 
        defaultToolbar: ['filter', 'exports', 'print'],
        id:'list',
        cols: [[
            {checkbox: true, fixed: true},
            {field: 'id', title: 'ID', width: 80, fixed: true, sort: true},
            {title: '所属微信', templet:function(d){
                return d.wx?d.wx.name:'';
            }},
            {field: 'username', title: '用户名',templet:"#username"},
            {field: 'nickname', title: '昵称'},
            {field: 'sex', title: '性别', templet:"#sex"},
            {field: 'create_time', title: '注册时间', width: 180,templet:'#create_time'},
            {title:'操作',width:150, toolbar: '#action',align:"center"},

        ]],
        limits: [10, 15, 20, 25, 50, 100],
        limit: 15,
        page: true
    });
    // 搜索
    $('#searchBtn').click(function(){
        searchObj['keys'] = $('#keys').val();
        table.reload('list',{where:searchObj});
    }) 
});


</script>